package composite;

import java.util.List;

public class MainTest12 {
    public static void main(String[] args) {
        Folder rootFolder = new Folder("C:");
        Folder childFolder = new Folder("Game");
        File file = new File("LOL.exe");
        rootFolder.add(childFolder);
        childFolder.add(file);
        displayTree(rootFolder);
    }

    public static void displayTree(IFile rootFolder) {
        rootFolder.display();
        List<IFile> children = rootFolder.getChild();
        for (IFile child : children) {
            if (child instanceof File) {
                child.display();
            }else{
                displayTree(child);
            }
        }
    }
}
